.plugin-dialog {
  max-width: min(95vw, 1024px) !important;
  width: 100%;
  height: auto;
  max-height: 90vh;
}

.plugin-wrapper {
  max-width: calc(95vw - 3rem);
  max-height: calc(90vh - 8rem);
  overflow-y: auto;
  padding: 0.5rem;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
}

.plugin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0 0.5rem;
}

.plugin-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.plugin-header-actions {
  display: flex;
  gap: 0.5rem;
}

.plugin-list {
  width: 100%;
  flex: 1;
  
  & > div {
    height: 100%;
  }
  
  .space-y-3 {
    width: 100%;
    height: auto;
    padding: 0 0.5rem;
  }
}

.plugin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  transition: background-color 0.2s;
  cursor: pointer;
  min-height: 80px;
  width: 100%;
  box-sizing: border-box;
  
  &:hover {
    background-color: hsl(var(--muted-foreground) / 0.05);
  }
}

.plugin-item-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.plugin-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  flex-shrink: 0;
}

.plugin-info {
  flex: 1;
  min-width: 0;
}

.plugin-name {
  font-weight: 500;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plugin-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0.25rem 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plugin-url {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plugin-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.plugin-form {
  padding: 1rem;
  margin: 0 0.5rem;
}

.plugin-import-form {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background-color: transparent;
  margin: 0 0.5rem;
  transition: background-color 0.2s, border-color 0.2s;
  
  &:hover {
    background-color: hsl(var(--muted-foreground) / 0.05);
    border-color: hsl(var(--border-hover));
  }
}

.plugin-import-textarea {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  background-color: transparent;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  transition: border-color 0.2s, background-color 0.2s;
  
  &:hover {
    border-color: hsl(var(--border-hover));
    background-color: hsl(var(--muted-foreground) / 0.02);
  }
  
  &:focus {
    border-color: hsl(var(--border-active));
    background-color: hsl(var(--background));
    box-shadow: 0 0 0 2px hsl(var(--border-active) / 0.2);
  }
  
  &::placeholder {
    color: var(--muted-foreground);
    opacity: 0.7;
  }
}

.plugin-empty-state {
  text-align: center;
  padding: 2rem 0;
  color: var(--muted-foreground);
  margin: 0 0.5rem;
}

.plugin-empty-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  opacity: 0.5;
}

.plugin-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
  margin: 0 0.5rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .plugin-dialog {
    max-width: 95vw !important;
    margin: 1rem;
  }
  
  .plugin-wrapper {
    max-width: calc(95vw - 2rem);
    padding: 0.25rem;
    padding-top: 1rem;
  }
  
  .plugin-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
    text-align: center;
    padding: 0;
  }
  
  .plugin-header-title {
    justify-content: center;
  }
  
  .plugin-header-actions {
    justify-content: center;
    width: 100%;
  }
  
  .plugin-list {
    height: 60vh !important;
  }
  
  .plugin-item {
    flex-direction: column;
    gap: 1rem;
    padding: 0.75rem;
    align-items: stretch;
  }
  
  .plugin-item-content {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  
  .plugin-actions {
    justify-content: center;
    width: 100%;
  }
  
  .plugin-avatar {
    align-self: center;
  }
  
  .plugin-info {
    width: 100%;
    text-align: center;
  }
  
  .plugin-name,
  .plugin-description,
  .plugin-url {
    white-space: normal;
    word-break: break-all;
  }
  
  .plugin-form {
    padding: 0.75rem;
    margin: 0;
  }
  
  .plugin-import-form {
    padding: 0.75rem;
    margin: 0;
  }
  
  .plugin-import-textarea {
    font-size: 0.75rem;
  }
  
  .plugin-empty-state,
  .plugin-loading {
    margin: 0;
  }
  
  .plugin-form-row {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }
  
  .plugin-form-column {
    width: 100%;
  }
  
  .plugin-avatar-picker {
    align-self: center;
  }
  
  .plugin-test-scroll-area {
    max-height: calc(60vh - 100px);
  }
}

@media (max-width: 480px) {
  .plugin-dialog {
    max-width: 98vw !important;
    margin: 0.5rem;
  }
  
  .plugin-wrapper {
    max-width: calc(98vw - 1rem);
    padding-top: 0.75rem;
  }
  
  .plugin-header {
    margin-bottom: 0.75rem;
  }
  
  .plugin-item {
    padding: 0.5rem;
  }
  
  .plugin-actions {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  
  .plugin-form {
    padding: 0.5rem;
  }
  
  .plugin-import-form {
    padding: 0.5rem;
  }
  
  .plugin-import-textarea {
    font-size: 0.75rem;
  }
}

/* Plugin Editor styles */
.plugin-drawer-viewport {
  width: 100%;
  max-width: 100%;
}

.plugin-form-row {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  align-items: flex-end;
}

.plugin-form-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

.plugin-form-column-grow {
  flex: 1;
  min-width: 0;
}

.plugin-avatar-picker {
  width: 2.5rem !important;
  height: 2.5rem !important;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  transition: 0.2s ease-in-out;
  
  &:hover {
    border-color: hsl(var(--border-hover));
    background-color: hsl(var(--background-hover));
  }
  
  &:focus {
    border-color: hsl(var(--border-active));
    box-shadow: 0 0 0 2px hsl(var(--border-active) / 0.2);
  }
}

.plugin-test-scroll-area {
  max-height: calc(70vh - 120px);
  
  .scrollarea-viewport {
    padding-right: 0.5rem;
  }
  
  &[data-radix-scroll-area-viewport] {
    max-height: 100%;
  }
}

.plugin-picker-dialog {
  width: max-content !important;
  height: max-content !important;
  padding: 0 !important;

  .picker {
    --epr-category-navigation-button-size: 28px;
    --epr-search-input-bg-color: hsl(var(--background));
    --epr-search-border-color: hsl(var(--border-hover));
    --epr-bg-color: hsl(var(--background));
    --epr-category-label-bg-color: hsl(var(--background));

    img {
      padding: 0.5rem;
    }

    .epr-icn-search {
      width: 1rem;
      height: 1rem;
      transform: translateY(-0.55rem);
    }

    .epr-body {
      scrollbar-width: thin;
      -ms-overflow-style: none;

      &::-webkit-scrollbar {
        width: 6px;
      }
    }

    .epr-search-container {
      input {
        border: 1px solid hsl(var(--border));
      }
    }

    .epr-cat-btn {
      &:focus:before {
        border: none;
      }
    }

    * {
      font-family: var(--font-family) !important;
      font-size: 0.85rem !important;
    }
  }
}

/* MCP Tool Call styles */
.mcp-container {
  margin: 0.5rem 0;
  padding: 0.5rem;
  border-radius: 0.5rem;
  background-color: rgba(var(--primary) / 0.05);
  border: 1px solid rgba(var(--primary) / 0.1);
}

.mcp-tool-call {
  background-color: rgba(var(--background) / 0.5);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-top: 0.5rem;
}

.tool-arguments {
  background-color: rgba(var(--muted) / 0.3);
  border-radius: 0.375rem;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(var(--border) / 0.5);
}

.tool-result {
  border-radius: 0.375rem;
  overflow: hidden;
}

.tool-result .bg-blue-500\/10 {
  background-color: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.tool-result .bg-green-500\/10 {
  background-color: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.tool-result .bg-red-500\/10 {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.tool-result pre {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  max-height: 400px;
  overflow-y: auto;
}

/* MCP Tool Call Button styles */
.mcp-container button {
  transition: all 0.2s ease-in-out;
}

.mcp-container button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Status indicators */
.text-blue-500 {
  color: rgb(59, 130, 246);
}

.text-green-500 {
  color: rgb(34, 197, 94);
}

.text-red-500 {
  color: rgb(239, 68, 68);
}

.text-blue-600 {
  color: rgb(37, 99, 235);
}

.text-green-700 {
  color: rgb(21, 128, 61);
}

.text-red-600 {
  color: rgb(220, 38, 38);
}

/* Animation for spinner */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Responsive styles for MCP components */
@media (max-width: 768px) {
  .mcp-container {
    margin: 0.25rem 0;
    padding: 0.375rem;
  }
  
  .mcp-tool-call {
    padding: 0.75rem;
  }
  
  .tool-arguments,
  .tool-result {
    padding: 0.5rem;
  }
  
  .tool-result pre {
    font-size: 0.75rem;
    max-height: 300px;
  }
}

/* MCP Debug Tabs styles */
.mcp-debug-tabs {
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 2px;
  background-color: hsl(var(--muted-foreground) / 0.05);
  padding: 2px;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
}

.mcp-debug-tabs [data-state="active"] {
  background-color: var(--background);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: background-color 0.2s;
}

.mcp-debug-tabs [data-state="inactive"] {
  background-color: transparent;
  color: var(--muted-foreground);
  transition: background-color 0.2s;
}

.mcp-debug-tabs [data-state="inactive"]:hover {
  background-color: hsl(var(--muted-foreground) / 0.05);
  color: var(--foreground);
}

/* Debug panel tabs content */
.debug-panel [data-orientation="horizontal"][role="tablist"] {
  margin-bottom: 0.75rem;
}

.debug-panel [role="tabpanel"] {
  min-height: 60px;
  max-height: 400px;
}

/* MCP Debug ScrollArea styles */
.mcp-debug-scroll-area {
  height: 300px;
  max-height: 300px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background-color: hsl(var(--muted-foreground) / 0.02);
}

.mcp-debug-scroll-area [data-radix-scroll-area-viewport] {
  height: 100%;
  width: 100%;
  border-radius: inherit;
}

.mcp-debug-scroll-area pre {
  border: none;
  background-color: transparent;
  margin: 0;
  min-height: 100%;
  width: 100%;
}

/* MCP Debug Content styles (for non-scrollable content) */
.mcp-debug-content {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background-color: hsl(var(--muted-foreground) / 0.02);
}

.mcp-debug-content pre {
  border: none;
  background-color: transparent;
  margin: 0;
}

/* ScrollArea scrollbar styling to match plugin-item theme */
.mcp-debug-scroll-area [data-radix-scroll-area-scrollbar] {
  background-color: hsl(var(--muted-foreground) / 0.05);
  border-radius: 0.375rem;
  transition: background-color 0.2s;
  width: 8px;
  height: 8px;
  padding: 1px;
}

.mcp-debug-scroll-area [data-radix-scroll-area-scrollbar]:hover {
  background-color: hsl(var(--muted-foreground) / 0.08);
}

.mcp-debug-scroll-area [data-radix-scroll-area-scrollbar][data-orientation="vertical"] {
  width: 8px;
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
}

.mcp-debug-scroll-area [data-radix-scroll-area-scrollbar][data-orientation="horizontal"] {
  height: 8px;
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
}

.mcp-debug-scroll-area [data-radix-scroll-area-thumb] {
  background-color: hsl(var(--muted-foreground) / 0.3);
  border-radius: 0.25rem;
  transition: background-color 0.2s;
  position: relative;
}

.mcp-debug-scroll-area [data-radix-scroll-area-thumb]:hover {
  background-color: hsl(var(--muted-foreground) / 0.5);
}

.mcp-debug-scroll-area [data-radix-scroll-area-corner] {
  background-color: hsl(var(--muted-foreground) / 0.05);
}

/* Responsive styles for debug tabs */
@media (max-width: 768px) {
  .mcp-debug-tabs {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 1px;
    padding: 1px;
  }
  
  .debug-panel [role="tabpanel"] {
    min-height: 40px;
    max-height: 250px;
  }
  
  .mcp-debug-scroll-area {
    height: 180px;
    max-height: 180px;
  }
  
  .mcp-debug-scroll-area pre,
  .mcp-debug-content pre {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .mcp-debug-tabs {
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
  }
  
  .debug-panel [role="tabpanel"] {
    min-height: 30px;
    max-height: 180px;
  }
  
  .mcp-debug-scroll-area {
    height: 120px;
    max-height: 120px;
  }
  
  .mcp-debug-scroll-area pre,
  .mcp-debug-content pre {
    padding: 0.5rem;
  }
}
